package com.jwell.bigdata.model

import com.jwell.bigdata.base.BaseModel
import com.jwell.bigdata.contract.LoginContract
import com.jwell.bigdata.utils.BaseSubscriber
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

class LoginModel :LoginContract.Model,BaseModel(){
    override fun checkLogin(ticket:String, baseSubscriber: BaseSubscriber) {
        getApiStore().checkLogin(ticket).subscribeOn(Schedulers.io())
            .unsubscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(baseSubscriber)
    }

    override fun login(account: String, pass: String, baseSubscriber: BaseSubscriber) {
        getApiStore().login(account,pass).subscribeOn(Schedulers.io())
            .unsubscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(baseSubscriber)
    }

}